<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
	
	</head>

	<body>
		<form>
			<input type="number" id="num1" />
			<select id="sel">
				<option>+</option>
				<option>-</option>
				<option>*</option>
				<option>/</option>
				<option>%</option>
				<option>^</option>
			</select>
			<input type="number" id="num2" />
			<input type="button" value="=" id="but" onclick="jisuan()" />
			<input type="number" id="num3" />
		</form>
        <script>
			function jisuan() {
				var a = document.getElementById('num1').value;
				var b = document.getElementById('sel').value;
				var c = document.getElementById('num2').value;
				var d = document.getElementById('num3').value;

				if(b == "+") {
					d = parseInt(a) + parseInt(c); 

				} else if(b == "-") {
					d = a - c;
				} else if(b == "*") {
					d = a * c;
				} else if(b == "/") {
					if(c == 0) {
						alert("除数不得为\"0\"！！");
					}
					d = a / c;

				} else if(b == "%") {
					d = a % c;

				} else if(b == "^") {
					var e = 1;
					for(var p = 0; p <= c - 1; p++) {
						e = e * a;
					}
					d = e;
				} else {

				}
				document.getElementById('num3').value = d;

			}
		</script>
	</body>

</html>